/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package locusts.common.entities;

import java.awt.Shape;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import locusts.common.Player;

/**
 *
 * @author hamish
 */
public class InputEntity extends CollidableEntity {

    private Player player;

    public InputEntity(int typeId, Player player, double x, double y,
            Shape shape) {
        super(typeId, x, y, shape);
        this.player = player;
    }

    public InputEntity(int typeId, Player player, double x, double y,
            Shape shape,
            double orientation) {
        super(typeId, x, y, shape, orientation);
        this.player = player;
    }

    public InputEntity(int typeId, Player player, double x, double y,
            Shape shape,
            double orientation, double energy) {
        super(typeId, x, y, shape, orientation, energy);
        this.player = player;
    }

    public InputEntity(InputEntity that) {
        super(that);
        this.player = that.player;
    }

    public Player getPlayer() {
        return player;
    }

    private void writeObject(ObjectOutputStream out) throws IOException {
        out.writeObject(player);
    }

    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        player = (Player)in.readObject();
    }

    @Override
    public InputEntity clone() {
        return new InputEntity(this);
    }
}
